<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/28
 * Time: 11:35
 */

namespace app\common\model;


use think\Model;

class Jewel extends Model
{

    public function getStatusTextAttr($value,$data)
    {
        $status = [1=>'待审核',  2=>'审核通过' , 0=>'驳回'];
        return $status[$data['status']];
    }

    public function getList($where = []){
        return $this->alias('a')
            ->join('users u','u.user_id = a.user_id','LEFT')
            ->where($where)
            ->order('a.id desc')
            ->field('a.*,u.nick_name,u.uuid,u.header_img,u.spread_total,u.spread_cash')
            ->paginate('',false,['query'=>request()->param()]);
    }


    public function getDetail($where = [])
    {
        return $this->alias('a')
            ->join('users u','u.user_id = a.user_id','LEFT')
            ->where($where)
            ->field('a.*,u.nick_name,u.uuid,u.header_img')
            ->find();
    }


}